#include<stdio.h>
#include<unistd.h>
#include<assert.h>

//孤儿进程-父进程先退出
int main()
{
    int ret = fork();
    assert(ret >= 0);
    if(ret == 0)
    {
        while(1)
        {
            printf("子进程运行中！\n");
            sleep(1);
        }
    }
    else if(ret > 0)
    {
        int i = 0;
        while(1)
        {
            printf("父进程运行中！\n");
            sleep(1);
            if(i++ == 5)
                break;
        }
    }
    return 0;
}